﻿#pragma once
#include <chrono>
#include <cmath>
#include <exception>
#include <fstream>
#include <iostream>
#include <limits>
#include <numeric>
#include <string>
#include <queue>
#include <vector>
#include <opencv2/dnn/dnn.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>

#include "onnxmodel_error_code.h"
#include "onnxmodel_struct.h"
#include "model_manager.h"
#include "common/base_struct.h"


namespace ai {

class ModelConfig;
class ONNXPredictor;
class ONNXClsPredictor;
class ONNXOcrRecPredictor;
class ONNXOCRDetector;
class ONNXDetPredictor;
class ONNXSegPredictor;
class ONNXOCRPostProcessor;

class ONNXModelManager: public ai::ModelManager
{
public:
  ONNXModelManager(LogInfo *log_info);
  ~ONNXModelManager();

  int init_model_imp(std::string model_path, std::string cfg_path, int gpu_idx, ai::InitModelData &imd, BasePredictor** infer, int debug_mode);

  int free_model(int md_idx);

private:
  int load_model(std::string model_path, ai::ONNXPackPredictor* oxp, std::string model_id);


private:
  // friend class ClsPredictor;
  friend class ONNXOcrRecPredictor;
  // friend class OCRDetector;
  friend class ONNXDetPredictor;
  // friend class SegPredictor;

};


}